@extends('default.layouts.master')

@section('title', '管理员管理')
@section('detail-title', '管理员详情')

@section('detail-content')
    <div class="hr-line-dashed"></div>
    <div class="form-group">
        <label class="col-sm-3 control-label">管理员名称：</label>
        <div class="col-sm-8">
            <input id="admin_name" name="admin_name" class="form-control" type="text"
                   value="@if(!empty($detail)){{$detail->admin_name}}@endif"/>
            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 唯一标识</span>
        </div>
    </div>
    <div class="hr-line-dashed"></div>
    <div class="form-group">
        <label class="col-sm-3 control-label">所属用户组：</label>
        <div class="col-sm-8">
            <select name="role_id" class="form-control"></select>
        </div>
    </div>
    <div class="hr-line-dashed"></div>
    <div class="form-group">
        <label class="col-sm-3 control-label">E-mail：</label>
        <div class="col-sm-8">
            <input id="admin_email" name="admin_email" class="form-control" type="text"
                   value="@if(!empty($detail)){{$detail->admin_email}}@endif">
            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 唯一标识</span>
        </div>
    </div>
    <div class="hr-line-dashed"></div>
    <div class="form-group">
        <label class="col-sm-3 control-label">密码：</label>
        <div class="col-sm-8">
            <input id="password" name="password" class="form-control" type="password">
            <span class="help-block m-b-none">
                <i class="fa fa-info-circle"></i>
                @if(!empty($detail))
                    已设置密码【再次输入，默认会更改；不输入，则不变动】
                @else
                    请设置密码【默认为：123456】
                @endif
            </span>
        </div>
    </div>
    <div class="hr-line-dashed"></div>
    <div class="form-group">
        <label class="col-sm-3 control-label">确认密码：</label>
        <div class="col-sm-8">
            <input id="password_confirmation" name="password_confirmation" class="form-control" type="password">
            <span class="help-block m-b-none"><i class="fa fa-info-circle"></i> 请再次输入您的密码</span>
        </div>
    </div>
    <div class="hr-line-dashed"></div>
    <div class="form-group">
        <label class="col-sm-3 control-label">
            是否启用
            <br/>
            <small class="text-navy">启用</small>
            才可以登录
        </label>
        <div class="col-sm-8">
            <div class="radio i-checks">
                <label>
                    <input type="radio" value="1" name="is_check" @if(empty($detail) || (!empty($detail) && $detail->is_check == 1)) checked @endif> <i></i> 启用
                </label>
                <label>
                    <input type="radio" value="0" name="is_check" @if(!empty($detail) && $detail->is_check == 0) checked @endif > <i></i> 禁用
                </label>
            </div>
        </div>
    </div>
    <div class="hr-line-dashed"></div>
    <div class="form-group">
        <div class="col-sm-8 col-sm-offset-3">
            <input id="admin_id" name="admin_id" class="form-control" type="hidden"
                   value="@if(!empty($detail)){{$detail->admin_id}} @else 0 @endif">
            <button class="btn btn-primary" type="submit"><i class="fa fa-check"></i> 提交</button>
        </div>
    </div>
@stop

@section('content')
@include('default.layouts.master.detail')
@stop
@section('script')
    <script type="text/javascript">
        window.onload = function () {
            closeLayerLoading(function () {
                checkradioClass();
                getRoleSelectList('{{ get_api_admin_url('roles/getSelectLists', '', 1) }}', (!res || isEmpty(res.roles)) ? 0 : res.roles[0]['role_id'], $('form#detail select[name=role_id]'))
            });
        }
    </script>
@stop
